
import request from '@/utils/request';
import fileRequest from '@/utils/fileRequest';

// 查询组织列表
export async function queryOrgList(params) {
  return request('/s/user/queryPageList', {
    method: 'POST',
    data: params,
  });
}
// 查询user列表
export async function queryUserList(params) {
  return request('/s/user/queryPageList', {
    method: 'POST',
    data: params,
  });
}

/**
 * 查询树形组织
 * @param params
 * @returns {Promise<void>}
 */
export async function queryTreeOrgList(params) {
  return request('/s/org/queryTree', {
    method: 'POST',
    data: params,
  });
}

// 新增组织
export async function addOrg(params) {
  return request('/s/user/add', {
    method: 'POST',
    data: params,
  });
}

// 修改
export async function updateOrg(params) {
  return request('/s/user/update', {
    method: 'POST',
    data: params,
  });
}

// 删除
export async function removeOrg(params) {
  return request('/s/user/delete', {
    method: 'POST',
    data: params,
  });
}

// 密码重置
export async function resetPassword(params) {
  return request('/s/user/resetPassword', {
    method: 'POST',
    data: params,
  });
}

// 设置状态
export async function updateState(params) {
  return request('/s/user/updateState', {
    method: 'POST',
    data: params,
  });
}

// 组织迁移
export async function transferUserOrg(params) {
  return request('/s/user/transferUserOrg', {
    method: 'POST',
    data: params,
  });
}

// // 头衔
// export async function queryTitle(params) {
//   return request('/s/user/queryTitle', {
//     method: 'POST',
//     data: params,
//   });
// }

// 用户角色
export async function queryRole(params) {
  return request('/s/user/queryRole', {
    method: 'POST',
    data: params,
  });
}

// 初始密码
export async function queryPassWord(params) {
  return request('/s/user/queryPwd', {
    method: 'POST',
    data: params,
  });
}

//  用户职级
export async function queryLevel(params) {
  return request('/s/user/queryLevel', {
    method: 'POST',
    data: params,
  });
}

//  用户导入
export async function importData(params) {
  return fileRequest('/s/user/importData', {
    method: 'post',
    data: params,
  });
}

// 弱密码导入
export async function weakpwdImport(params) {
  return fileRequest('/s/weakpwd/import', {
    method: 'POST',
    data: params,
  });
}

// 弱密码下载模板
export async function weakpwdDownloadt(params) {
  return request('/s/weakpwd/download', {
    method: 'POST',
    data: params,
  });
}

// 查询用户角色
export async function queryRoleByCode(params) {
  return request('/s/user/queryRoleByCode', {
    method: 'POST',
    data: params,
  });
}

// 验证手机号已经绑定
export async function checkPhoneUnique(params) {
  return request('/s/user/checkPhoneUnique', {
    method: 'POST',
    data: params,
  });
}
// 验证身份证已经绑定
export async function checkIdnumberUnique(params) {
  return request('/s/user/checkIdnumberUnique', {
    method: 'POST',
    data: params,
  });
}
// 验证邮箱已经绑定
export async function checkEmailUnique(params) {
  return request('/s/user/checkEmailUnique', {
    method: 'POST',
    data: params,
  });
}
